'use strict';
module.exports = app => {
  const { STRING, BOOLEAN, BIGINT, DECIMAL } = app.Sequelize;

  const MallGoods = app.model.define('mall_goods', {
    name: {
      type: STRING,
      allowNull: false,
      comment: '商品名称',
    },
    shop_id: {
      type: BIGINT,
      allowNull: false,
      comment: '商铺id',
    },
    category_id: {
      type: BIGINT,
      allowNull: false,
      comment: '分类id',
    },
    price: {
      type: DECIMAL(10, 2),
      allowNull: false,
      comment: '商品价格',
    },
    num: {
      type: BIGINT,
      allowNull: false,
      comment: '商品库存',
    },
    img: {
      type: STRING,
      allowNull: false,
      comment: '商品图片',
    },
    describe: {
      type: STRING,
      allowNull: false,
      comment: '商品内容',
    },
    comment_count: {
      type: BIGINT,
      allowNull: false,
      defaultValue: 0,
      comment: '评论数',
    },
    collection_count: {
      type: BIGINT,
      allowNull: false,
      defaultValue: 0,
      comment: '收藏数',
    },
    view_count: {
      type: BIGINT,
      allowNull: false,
      defaultValue: 0,
      comment: '浏览数',
    },
    status: {
      type: BOOLEAN,
      allowNull: false,
      defaultValue: 1,
      comment: '发布状态 1 已发布｜ 0 草稿',
    },

  });

  return MallGoods;
};
